﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

namespace lianxi
{
    public partial class index : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
           string name = Session["username"].ToString();
              Label1.Text = "欢迎您的到来:"+name;
              if (Request.Cookies[Server.UrlEncode(Session["username"].ToString())] != null)
              {
                  xaunze(Request.Cookies[Server.UrlEncode(Session["username"].ToString())].Value.ToString());
              }
        }
        
   
        public void xaunze(string color)
        {
            if (color == "Red")
            {
                this.Label1.ForeColor = Color.Red;
            }
            else if (color == "Blue")
            {
                this.Label1.ForeColor = Color.Blue;
            }
            else if (color == "Yellow")
            {
                this.Label1.ForeColor = Color.Yellow;
            }
            else
            {
                this.Label1.ForeColor = Color.Black;
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            Response.Redirect("login.aspx");
        }

        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            xaunze(this.DropDownList1.SelectedValue);
        }

        protected void Button1_Click1(object sender, EventArgs e)
        {
            HttpCookie color = new HttpCookie(Server.UrlEncode(Session["username"].ToString()), DropDownList1.SelectedValue);
            color.Expires = DateTime.Now.AddDays(3);
            Response.Cookies.Add(color);
        }  
    }
}